<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Builder;

class Teacher extends Model
{
    protected $table = 'teacher';

    /**
     * 获取器
     */
    public function getTeacherHeadAttribute($value)
    {
        return getDomain() . '/' . $value;
    }

    //查询店铺名
    public function store()
    {
        return $this->hasOne('App\Models\Store','id','store_id');
    }


    /**
     * 只查询未删除
     *
     * @param  \Illuminate\Database\Eloquent\Builder  $query
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function scopedisplay(Builder $query)
    {
        return $query->where('is_display',1);
    }
}
